import { axios } from "@/utils/request";
import { baseUrl } from "@/services/baseUrl";

//标准规范库、左侧树
export function getBaseTreeList(params) {
  return axios({
    url: baseUrl + "/probusiness/archiveDirectory/getTreeList",
    method: "GET",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    params,
  });
}

//标准规范库、右侧列表
export function getBasePage(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/archiveFile/getPageSet?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=createTime`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//标准规范库、左侧树删除
export function deleteBaseTree(data) {
  let { uuid } = data;
  return axios({
    url: baseUrl + `/probusiness/archiveDirectory/deleteBatch?uuids=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data: {},
  });
}
export function deleteBasePage(data) {
  let { uuid } = data;
  return axios({
    url: baseUrl + `/probusiness/archiveFile/deleteBatch?uuids=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data: {},
  });
}

//项目模版资料库-左侧树
export function documentTemplateInformationTree(data) {
  return axios({
    url:
      baseUrl + "/probusiness/documentTemplateInformationTree/getTreeByProCode",
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目模版资料库-分页
export function documentTemplateInformationFile(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentTemplateInformationFile/getPageSet?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=createTime`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目模版资料库-提交
export function approveTemplateInformation(data) {
  let { uuid } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentTemplateInformationFile/approveTemplateInformation?uuid=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目经验库-左侧树
export function documentProjectExperienceTree(data) {
  return axios({
    url:
      baseUrl + "/probusiness/documentProjectExperienceTree/getTreeByProCode",
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//项目经验库-分页
export function documentProjectExperienceFile(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentProjectExperienceFile/getPageSet?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=createTime`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目经验库-发布
export function addExperienceFeedback(data) {
  let { fileUuid } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentProjectExperienceFeedback/save?fileUuid=${fileUuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//项目经验库-评论列表
export function pageExperienceFeedback(data) {
  let { fileUuid } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentProjectExperienceFeedback/getList?fileUuid=${fileUuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目经验库-评论删除
export function deleteCommentExperience(data) {
  let { uuid } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentProjectExperienceFeedback/deleteData?uuid=${uuid}`,
    method: "GET",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data: {},
  });
}

//项目经验库-浏览次数
export function experienceViewers(params) {
  return axios({
    url:
      baseUrl +
      `/probusiness/documentProjectExperienceFile/increaseViewersNumber`,
    method: "GET",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    params,
  });
}
//项目经验库-分项保存
export function experienceSharSave(data) {
  return axios({
    url: baseUrl + `/probusiness/documentProjectExperienceShare/save`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目资料库-左侧树
export function getMaterialTreeList(params) {
  return axios({
    url: baseUrl + "/probusiness/documentProjectMaterialTree/getTreeList",
    method: "GET",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    params,
  });
}

//项目资料库-右侧列表
export function getMaterialPage(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentProjectMaterialFile/getPageSet?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=createTime`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//项目资料库树-新增
export function addTreeMaterial(data) {
  return axios({
    url: baseUrl + "/probusiness/documentProjectMaterialTree/save",
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//项目资料库树-编辑
export function updateTreeMaterial(data) {
  return axios({
    url: baseUrl + "/probusiness/documentProjectMaterialTree/update",
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//项目资料库树-删除
export function deleteTreeMaterial(data) {
  let { uuid } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentProjectMaterialTree/deleteBatch?uuids=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data: {},
  });
}
//项目资料库列表-新增
export function addTableMaterial(data) {
  return axios({
    url: baseUrl + "/probusiness/documentProjectMaterialFile/save",
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//项目资料库列表-编辑
export function updateTableMaterial(data) {
  return axios({
    url: baseUrl + "/probusiness/documentProjectMaterialFile/update",
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//项目资料库列表-删除
export function deleteTableMaterial(data) {
  let { uuid } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentProjectMaterialFile/deleteBatch?varchar=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data: {},
  });
}

//项目资料库-导出
export function exportBaseExcel(params) {
  return axios({
    url: baseUrl + `/probusiness/documentProjectMaterialTree/exportFile`,
    method: "GET",
    apiType: "file",
    responseType: "arraybuffer",
    params,
  });
}

//项目资料库-归档
export function archiveBase(params) {
  return axios({
    url: baseUrl + `/probusiness/documentProjectMaterialFile/archive`,
    method: "GET",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    params,
  });
}

//项目流程库-分页
export function pageFlowPath(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/configProcessNode/getPageSet?pageNo=${page}&pageSize=${pageSize}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目流程库-保存
export function saveFlowPath(data) {
  return axios({
    url: baseUrl + `/probusiness/configProcessNode/save`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目流程库-编辑
export function updateFlowPath(data) {
  return axios({
    url: baseUrl + `/probusiness/configProcessNode/update`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目流程库-详情
export function detailFlowPath(data) {
  return axios({
    url: baseUrl + `/probusiness/configProcessNode/getDataByPro`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目流程库-节点状态
export function getListByProcessId(data) {
  return axios({
    url: baseUrl + `/probusiness/configProcessNodeDetail/getListByProcessId`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}

//项目流程库删除
export function deleteFlowPath(data) {
  let { uuid } = data;
  return axios({
    url: baseUrl + `/probusiness/projectProcess/deleteBatch?uuids=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data: {},
  });
}

//项目流程库详情
export function submitFlowPath(data) {
  let { uuid } = data;
  return axios({
    url: baseUrl + `/probusiness/projectProcess/submit?uuid=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data: {},
  });
}

//设计资料库提交
export function submitDesign(data) {
  let { uuid } = data;
  return axios({
    url: baseUrl + `/probusiness/archiveDirectory/submit?uuid=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data: {},
  });
}

//勘察管理-分页
export function designPlanTree(params) {
  return axios({
    url: baseUrl + `/probusiness/archiveDirectory/getTreeListDesignPlan`,
    method: "GET",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    params,
  });
}
//勘察管理-下载模版
export function designPlanTemplate(params = {}) {
  return axios({
    url: baseUrl + `/probusiness/archiveDirectory/downloadTemplate`,
    method: "GET",
    apiType: "file",
    responseType: "arraybuffer",
    params,
  });
}
//勘察管理-批量导入
export function importDesignPlan(file, proCode) {
  return axios({
    url:
      baseUrl + `/probusiness/archiveDirectory/importExcel?proCode=${proCode}`,
    method: "POST",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    data: file,
  });
}

//创新成果-左侧树
export function getAchievementTree(data) {
  let { proCode } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentScientificAchievements/getTypeList?proCode=${proCode}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//创新成果-右侧列表
export function getAchievementPage(data) {
  let { page, pageSize } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentScientificAchievements/getPageSet?pageNo=${page}&pageSize=${pageSize}&order=desc&sort=createTime`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//创新成果-下拉框树
export function getProTreeSelect(data = {}) {
  return axios({
    url: baseUrl + `/mdata/organization/getTreeSysOrganizationCompanyProject`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//创新成果-列表删除
export function deleteAchievement(data) {
  let { uuid } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentScientificAchievements/deleteBatch?uuids=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data: {},
  });
}
//创新成果-新增
export function addAchievement(data) {
  return axios({
    url: baseUrl + "/probusiness/documentScientificAchievements/save",
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//创新成果-编辑
export function editAchievement(data) {
  return axios({
    url: baseUrl + "/probusiness/documentScientificAchievements/update",
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data,
  });
}
//创新成果-详情
export function detailAchievement(data) {
  let { uuid } = data;
  return axios({
    url:
      baseUrl +
      `/probusiness/documentScientificAchievements/getDetailByUuid?uuid=${uuid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8",
    },
    data: {},
  });
}
